perm filename SYSDEP.TEX[TEX,ALS]1 blob sn#615672 filedate 1981-10-01 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00004 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	\input dochd3
C00020 00003
C00036 00004	\index
C00051 ENDMK
C⊗;
\input dochd3

\def\dispentry#1#2{{}
	\spaceskip 3.333pt plus 10pt minus 2pt
	\xspaceskip 4.444pt plus 11pt minus 3pt
	\parindent 0pt
	$$\hbox par 11cm{\hangindent 3cm after 1\hbox to 3cm{#1\hfil\quad}#2}
	$$
	\parindent 20pt
	}
\def\dispar#1\par{{}
	\spaceskip 3.333pt plus 2pt minus 2pt
	\xspaceskip 3.444pt plus 2pt minus 3pt
	\parindent 0pt
	$$\hbox par 7cm{#1}
	$$
	\parindent 20pt
	}
\def\hide#1{\hbox to 0pt{\hss#1}}
\def\α{\hide{-}\ }
\def\β{\hide{$\bullet$}\ }
\def\runningrighthead#1{\gdef\chead{\:m#1}} %\runningrighthead sets chead
 
\advcount0
\secbegin \head{THE SYSTEM DEPENDENT MODULE OF \TEX}\runninglefthead{\TEX: SYSTEM DEPENDENCIES}
 This module contains all the parts of \TEX\ 
that may need some reprogramming for each different system environment. 
If a compiler does not suport external procedures or there is no interest
in reprogramming them to generate more efficient code, it is possible 
to get by just doing as follows:
\dispar \hide{-} Make all necessary changes in this module.\par
\dispar \hide{-} Modify the beginning sections of \.{TEX.DOC} accordingly.\par
\dispar \hide{-} Delete the first, second and last pages of
 \.{SYSDEP.DOC} (the one file you are now reading).\par
\dispar \hide{-} Put the remaining of this module in the place of the external
procedure declarations in \.{TEX.DOC}.\par
the result will be ready for \.{UNDOC} to produce a single \.{TEX.PAS}
source file.\par
 The data structures declared in \TEX\ have been
designed having in mind a machine and a compiler
that packs fields correctly to the byte. That means that
fields in some records are allocated more space than necessary and, some times,
records take extra words to allocate fields that could have been allocated
in prevously assigned words. But the wasted extra space is not very significant,
and probably does not justify the effort to change the structures here and
in the main module. Rather, the size of the structures should be modified if
the memory space is at premium.
\pascal
\1\3\2\&{program} $\\{sysdep},\45\\{InitStrings},\45\\{ProduceString},\45
\\{AppndString},\45\\{AppndReal},\45\\{InitSysdep}
,\45\\{Release},\45\\{InChTer},\45\\{InLnTer}
,\45\\{OutChErr},\45\\{OutLnErr},\45\\{SendCh},\45
\\{SendLn},\45\\{SendStarted},\45\\{Close},\45\\{Print}
,\45\\{PrintLn},\45\\{PrintInt},\45\\{PrintReal}
,\45\\{PrintFileName},\45\\{PrintOctal},\45
\\{InLn},\45\\{GetFirstLine},\45\\{ForceBufferOut}
,\45\\{TraceLine},\45\\{DeclareOFil},\45\\{InitFileName}
,\45\\{AppendToName},\45\\{ReadFontInfo},\45
\\{DvI},\45\\{IntOut},\45\\{CloseOut},\45\\{SetTableSizes}
,\45\\{WriteSecondMem},\45\\{WriteEqTb}
,\45\\{WriteHyphenTb},\45\\{WritePageTb},\45\\{WriteDelimTb}
,\45\\{WriteFMem},\45\\{GetTableSizes}
,\45\\{InitSecondMem},\45\\{InitEqTb},\45\\{InitHyphenTb}
,\45\\{InitPageTb},\45\\{InitDelimTb},\45
\\{InitFMem}$\1;
\3\2\1\&{const} $\null$\6Constants in the outer block{ \:m13\7}$\null 
$
\3\2\1\&{type} $\null$\6Types in the outer block{ \:m5\7}$\null $
\3\2\1\&{var} $\null$\6Globals in the outer block{ \:m15\7}$\null 
$

\secbegin Definitions for the memory of \TEX
\pascal
\1\3\2\1\&{define} \\{memsize} $=$ $49152\null$\40\ $\{\;$size of the main memory structure of \TEX$\;\}$
$\null
$
\3\2\1\&{define} \\{secondmem} $=$ $25012\null$\40\ $\{\;$size of the part of the main memory used in single node blocks$\;\}$
$\null
$

\secbegin Definitions for the table of equivalents
\pascal
\1\3\2\1\&{define} \\{hprime} $=$ $89\null$\40\ $\{\;$range of hash values$\;\}$
$\null
$
\3\2\1\&{define} \\{hashsize} $=$ $1009\null$\40\ $\{\;$hash table size, must be prime and $<2↑{bound\ of\ \\{sixteenbits}-127}$$\;\}$
$\null
$
\3\2\1\&{define} \\{texpars} $=$ $21\null$\40\ $\{\;$number of distinct parameters settable by \.{\\chpar}$\;\}$
$\null
$
\3\2\1\&{define} \\{locs} $=$ $23\null$\40\ $\{\;$values of local quantities (\.{\\:},\.{\\baselineskip}, etc.)$\;\}$
$\null
$
\3\2\1\&{define} \\{eqtbsize} $=$ $\\{hashsize}+128+128+128+15+\\{texpars}\null$\40\ $\{\;$size of table for current values$\;\}$
$\null
$

\secbegin Next follows a list of constants that can be adjusted for each installation
\pascal
\1\3\2\1\&{define} \\{stacksize} $=$ $80\null$\40\ $\{\;$size of input stacks$\;\}$
$\null
$
\3\2\1\&{define} \\{pagememsize} $=$ $8\null$\40\ $\{\;$number of page parameters$\;\}$
$\null
$
\3\2\1\&{define} \\{nfonts} $=$ $64\null$\40\ $\{\;$number of fonts allowed (must not be greater than 256)$\;\}$
$\null
$
\3\2\1\&{define} \\{maxfnt} $=$ $\\{nfonts}-1\null$\40\ $\{\;$highest font number$\;\}$
$\null
$
\3\2\1\&{define} \\{charsperfont} $=$ $128\null$\40\ $\{\;$assumed number of characters in a font$\;\}$
$\null
$
\3\2\1\&{define} \\{maxinfil} $=$ $6\null$\40\ $\{\;$maximum number of input files that can be open at the
							same time$\;\}$
$\null
$
\3\2\1\&{define} \\{maxfil} $=$ $\\{nfonts}+10+\\{maxinfil}\null$\40\ $\{\;$maximum number of file names \TEX\ remembers$\;\}$
$\null
$
\3\2\1\&{define} \\{bufsize} $=$ $200\null$\40\ $\{\;$size of the input buffer$\;\}$
$\null
$
\3\2\1\&{define} \\{maxlinelength} $=$ $150\null$\40\ $\{\;$maximum number of characters accepted
			 in a line of a file$\;\}$
$\null
$
\3\2\1\&{define} \\{exceptableEntryLength} $=$ $2\null$\40\ $\{\;$size of exceptable entry in words$\;\}$
$\null
$
\3\2\1\&{define} \\{excephyphEntryLength} $=$ $2\null$\40\ $\{\;$size of excephyph entry in words$\;\}$
$\null
$
\3\2\1\&{define} \\{suffixEntryLength} $=$ $3\null$\40\ $\{\;$size of suffix entry in words$\;\}$
$\null
$
\3\2\1\&{define} \\{prefixEntryLength} $=$ $3\null$\40\ $\{\;$size of prefix entry in words$\;\}$
$\null
$
\3\2\1\&{define} \\{btableEntryLength} $=$ $3\null$\40\ $\{\;$size of btable entry in words$\;\}$
$\null
$
\3\2\1\&{define} \\{readoutsize} $=$ $3\null$\40\ $\{\;$maximum size of the above$\;\}$
$\null
$

\par\vfill\eject\end


\3\2\1\&{define} \\{excepsize} $=$ $373\null$\40\ $\{\;$length of hyphenation tables: there should always
			 some slack in the exception table to allow for
			 efficient hashing;  since it is used as the hash
			 modulo, the length should always be prime$\;\}$
$\null
$
\3\2\1\&{define} \\{sufsize} $=$ $116$
\3\2\1\&{define} \\{prefsize} $=$ $109$
\3\2\1\&{define} \\{btabsize} $=$ $30$
\3\2\1\&{define} \\{fmemsize} $=$ $6400\null$\40\ $\{\;$size of font memory for secondary tables$\;\}$
$\null
$
\3\2\1\&{define} \\{fontinfosize} $=$ $8192\null$\40\ $\{\;$$\\{nfonts}\times 128$$\;\}$
$\null
$
\3\2\1\&{define} \\{bytesPerWord} $=$ $4\null$\40\ $\{\;$valid both for 32 and 36 bits per word$\;\}$
$\null
$

\secbegin \6Types in the outer block{ \:m5\7} \.{+=}\par
\pascal
\2$\\{oneOfTwo}=1\mathrel{\!.\,.\!}2$;
\2$\\{oneOfFour}=1\mathrel{\!.\,.\!}4$;
\2$\\{oneOfFive}=1\mathrel{\!.\,.\!}5$;
\2$\\{oneOfSix}=1\mathrel{\!.\,.\!}6$;\40\ $\{\;$these types are useful in more complicated declarations.$\;\}$


\note See also sections 8, 11, 24, 31, 58, 71, 73,  and 74.

\note This code is used in section 1.

\secbegin Ascii codes for some characters not recognized by the preprocessor
\pascal
\1\3\2\1\&{define} \\{null} $=$ $\hbox{\char'16}0$
\3\2\1\&{define} \\{linefeed} $=$ $\hbox{\char'16}12$
\3\2\1\&{define} \\{formfeed} $=$ $\hbox{\char'16}14$
\3\2\1\&{define} \\{carriagereturn} $=$ $\hbox{\char'16}15$
\3\2\1\&{define} \\{zero} $=$ $\hbox{\char'16}60$
\3\2\1\&{define} \\{one} $=$ $\hbox{\char'16}61$
\3\2\1\&{define} \\{two} $=$ $\hbox{\char'16}62$
\3\2\1\&{define} \\{three} $=$ $\hbox{\char'16}63$
\3\2\1\&{define} \\{four} $=$ $\hbox{\char'16}64$
\3\2\1\&{define} \\{five} $=$ $\hbox{\char'16}65$
\3\2\1\&{define} \\{six} $=$ $\hbox{\char'16}66$
\3\2\1\&{define} \\{seven} $=$ $\hbox{\char'16}67$
\3\2\1\&{define} \\{eight} $=$ $\hbox{\char'16}70$
\3\2\1\&{define} \\{nine} $=$ $\hbox{\char'16}71$

\secbegin \head{The basic record employed by \TEX}\par
 Most of \TEX's data structures are built on top of a single record
structure which is expected to be efficiently stored and accessed in
most systems. That record is declared below.
\pascal
\1\3\2\1\&{define} \\{eightbits} $≡$ $0\mathrel{\!.\,.\!}255\null$\40\ $\{\;$an 8-bit field$\;\}$
$\null
$
\3\2\1\&{define} \\{sixteenbits} $≡$ $0\mathrel{\!.\,.\!}65535\null$\40\ $\{\;$a 16-bit field$\;\}$
$\null
$

\secbegin \6Types in the outer block{ \:m5\7} \.{+=}\par
\pascal
\2$\\{halves2}=\mathop{\&{packed }\!}\null$\1\2\&{record} \0$\\{lhword}\mathrel:\\{sixteenbits}$;
\2\1\&{case} $\\{oneOfTwo}$ \&{of}
\2\1$1\mathrel:\null$
(\0$\\{rhword}\mathrel:\\{sixteenbits}$)
\3;
\2\1$2\mathrel:\null$
(\0$\\{byte2}\mathrel:\\{eightbits}$;
\2$\\{byte3}\mathrel:\\{eightbits}$)
\3\3\2\&{end}$\null\3
$;
\2$\\{bytes4}=\mathop{\&{packed }\!}\null$\1\2\&{record} \0$\\{byte0}\mathrel:\\{eightbits}$;
\2$\\{byte1}\mathrel:\\{eightbits}$;
\2\1\&{case} $\\{oneOfTwo}$ \&{of}
\2\1$1\mathrel:\null$
(\0$\\{rhword}\mathrel:\\{sixteenbits}$)
\3;
\2\1$2\mathrel:\null$
(\0$\\{byte2}\mathrel:\\{eightbits}$;
\2$\\{byte3}\mathrel:\\{eightbits}$)
\3\3\2\&{end}$\null\3
$;
\2$\\{memoryword}=\mathop{\&{packed }\!}\null$\1\2\&{record} \0\1\&{case} $\\{oneOfFour}$ \&{of}
\2\1$1\mathrel:\null$
(\0$\\{pts}\mathrel:\\{real}$)
\3;
\2\1$2\mathrel:\null$
(\0$\\{int}\mathrel:\\{integer}$)
\3;
\2\1$3\mathrel:\null$
(\0$\\{twohalves}\mathrel:\\{halves2}$)
\3;
\2\1$4\mathrel:\null$
(\0$\\{fourbytes}\mathrel:\\{bytes4}$)
\3\3\2\&{end}$\null\3
$;


\secbegin The following are definitions, types and globals employed all over
  the program. Corresponding definitions appear at the beginning of the main
module of \TEX.
 Syntactic sugar first
\pascal
\1\3\2\1\&{define} \\{continue} $=$ $10\null$\40\ $\{\;$end of body of loop$\;\}$
$\null
$
\3\2\1\&{define} \\{return} $=$ $50\null$\40\ $\{\;$go here to exit a procedure$\;\}$
$\null
$
\3\2\1\&{define} \\{done} $=$ $0\null$\40\ $\{\;$some labels for loop exits$\;\}$
$\null
$
\3\2\1\&{define} \\{done1} $=$ $1$
\3\2\1\&{define} \\{done2} $=$ $2$
\3\2\1\&{define} \\{failure} $=$ $1$
\3\2\1\&{define} \\{malformedname} $=$ $2$
\3\2\1\&{define} \\{needmore} $=$ $3$

\secbegin \6Loop exits{ \:m10\7} \.{+=}\par
\pascal
\2$\\{done}$
\3\2\1\&{define} \\{terminal} $≡$ $-1\null$\40\ $\{\;$identifier for the terminal$\;\}$
$\null
$
\3\2\1\&{define} \\{inputFile} $≡$ $-2\null$\40\ $\{\;$identifier for the {\it current} input file$\;\}$
$\null
$
\3\2\1\&{define} \\{outputFile} $≡$ $-3\null$\40\ $\{\;$identifier for the output file$\;\}$
$\null
$
\3\2\1\&{define} \\{dummyFont} $=$ $\\{maxfnt}+1$
\3\2\1\&{define} \\{filnam}\.{(\char'43)} $≡$ $(-(\.{\char'43})-2)\null$\40\ $\{\;$indices \\f in the \\{fileName} array are usually
			passed as \\{filnam}(\\f) to procedures dealing with
			strings, to help them find out whether the argument
			should be located in the \\{fileName} array or in
			the \\{strngpool}$\;\}$
$\null
$
\3\2\1\&{define} \\{stringsize} $=$ $64\null$\40\ $\{\;$size of a printable message$\;\}$
$\null
$

\note This code is used in section 50.


\secbegin \6Types in the outer block{ \:m5\7} \.{+=}\par
\pascal
\2$\\{asciiCode}=0\mathrel{\!.\,.\!}127$;\40\ $\{\;$7-bit \&{ascii}$\;\}$
\2$\\{asciiString}=\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{stringsize}-1]
\mathop{\&{\ of }\!}
\\{asciiCode}
$;
\2$\\{packedAsciiString}=\mathop{\&{packed }\!}\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{stringsize}-1]
\mathop{\&{\ of }\!}
\\{asciiCode}
$;
\3\2\1\&{define} \\{Increment}\.{(\char'43)} $≡$ $\.{\char'43}\mathrel:=\.{\char'43}+1$
\3\2\1\&{define} \\{Decrement}\.{(\char'43)} $≡$ $\.{\char'43}\mathrel:=\.{\char'43}-1$
\3\2\1\&{define} \\{UpperCase}\.{(\char'43)} $≡$ \2\&{begin} \0\1\&{if} $(\.{\char'43}>=\.{{\rm``}a{\rm''}})\mathbin{\&{and}}
(\.{\char'43}<=\.{{\rm``}z{\rm''}})$ \&{then}
\0$\.{\char'43}\mathrel:=\.{\char'43}-32$\3
\2\&{end}\40\ $\{\;$change lower case to upper case$\;\}$
\3\2\1\&{define} \\{LowerCase}\.{(\char'43)} $≡$ \2\&{begin} \0\1\&{if} $(\.{\char'43}>=\.{{\rm``}A{\rm''}})\mathbin{\&{and}}
(\.{\char'43}<=\.{{\rm``}Z{\rm''}})$ \&{then}
\0$\.{\char'43}\mathrel:=\.{\char'43}+32$\3
\2\&{end}\40\ $\{\;$change upper case to lower case$\;\}$
\3\2\1\&{define} \\{spacer} $=$ $10\null$\40\ $\{\;$type of characters treated as blank space$\;\}$
$\null
$
\3\2\1\&{define} \\{letter} $=$ $11\null$\40\ $\{\;$type of characters treated as letters$\;\}$
$\null
$
\3\2\1\&{define} \\{otherchar} $=$ $12\null$\40\ $\{\;$none of the above character types$\;\}$
$\null
$
\3\2\1\&{define} \\{charcodes} $=$ $\\{otherchar}+1\null$\40\ $\{\;$number of distinct codes allowed in \\{chartype}$\;\}$
$\null
$

\secbegin The following definitions belong exclusively to the system dependent part
of the program.
First come file, directory and device names as employed in the WAITS system
to designate external files. For each particular installations different
naming conventions may be needed.
\pascal
\1\3\2\1\&{define} \\{errfilnam} $≡$ $\.{'ERRORSTEM'}\null$\40\ $\{\;$the disk file where error messages are saved$\;\}$
$\null
$
\3\2\1\&{define} \\{outfilnam} $≡$ $\.{'TEXOUTDVI'}\null$\40\ $\{\;$name of output \.{.DVI} disk file$\;\}$
$\null
$
\3\2\1\&{define} \\{tblfilnam} $≡$ $\.{'PTEXINTBL'}\null$\40\ $\{\;$disk file from where initial contents of \TEX\ tables are read$\;\}$
$\null
$
\3\2\1\&{define} \\{ascfilnam} $≡$ $\.{'ASCII\ TBL'}\null$\40\ $\{\;$disk file containing 128 printable strings for the 128 ascii characters$\;\}$
$\null
$
\3\2\1\&{define} \\{strfilnam} $≡$ $\.{'STRINITBL'}\null$\40\ $\{\;$this disk file contains the strings appearing in \TEX's code$\;\}$
$\null
$
\3\2\1\&{define} \\{terfilnam} $≡$ $\.{'FOOBARTTY'}\null$\40\ $\{\;$name of the terminal, as an external file$\;\}$
$\null
$
\3\2\1\&{define} \\{libraryarea} $≡$ $244570637163\mathopen{\hbox{B}}+400000000000\mathopen{\hbox{B}}
\null$\40\ $\{\;$SIXBIT code for directory {\bf [TEX,SYS]}$\;\}$
$\null
$

\secbegin \6Constants in the outer block{ \:m13\7} \.{+=}\par
\pascal
\2$\\{terDevice}=\.{'TTY\ \ \ '}$;\40\ $\{\;$\.{'TER\ \ \ '} for DEBUGging purposes only,
				in case the \.{PASCAL} debugger uses the terminal
				(\.{TTY:}) as
				standard i/o device. It should be changed
				to \.{'TTY\ \ \ '} when not debugging.$\;\}$


\note This code is used in section 1.

\secbegin Next come the identifiers for the internal files, whose external file names
were given above.

\secbegin \6Globals in the outer block{ \:m15\7} \.{+=}\par
\pascal
\2$\\{terOut}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;\40\ $\{\;$the terminal as an \&{ascii} output file$\;\}$
\2$\\{terIn}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;\40\ $\{\;$the terminal as an \&{ascii} input file$\;\}$
\2$\\{errfil}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;\40\ $\{\;$the errors file as an \&{ascii} output file$\;\}$
\2$\\{fontfil}\mathrel:\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{memoryword}$;\40\ $\{\;$the font information file$\;\}$
\2$\\{outfil}\mathrel:\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{integer}$;\40\ $\{\;$the output \.{.DVI} file$\;\}$
\2$\\{tblfil}\mathrel:\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{integer}$;\40\ $\{\;$the file from where the initial contents of the
			 system tables are read$\;\}$
\2$\\{fileName}\mathrel:\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{maxfil}]\mathop{\&{\ of }\!}
\\{packedAsciiString}
$;\40\ $\{\;$names of files known to \TEX$\;\}$
\2$\\{filPtr}\mathrel:\\{integer}$;\40\ $\{\;$pointer to first free entry in \\{fileName}$\;\}$
\2$\\{fourbytemask}\mathrel:\\{integer}$;\40\ $\{\;$mask used to generate 2's complement numbers in 32 bits$\;\}$


\note See also sections 18, 25, 27, 52,  and 66.

\note This code is used in section 1.

\secbegin The maximum and minimum functions are not standard in PASCAL. Here they
are defined for \&{integer} arguments and result only.
\pascal
\1\3\2\1\1\&{function} $\\{intmax}(\\{x},\45\\{y}\mathrel:\\{integer})\mathrel:
\\{integer}$;
\3\2\&{begin} \0\1\&{if} $\\{x}>\\{y}$ \&{then}
\0$\\{intmax}\mathrel:=\\{x}$\3
\2\&{else} \0$\\{intmax}\mathrel:=\\{y}$
;
\2\&{end};
\3\2\1\1\&{function} $\\{intmin}(\\{m},\45\\{n}\mathrel:\\{integer})\mathrel:
\\{integer}$;
\3\2\&{begin} \0\1\&{if} $\\{m}>\\{n}$ \&{then}
\0$\\{intmin}\mathrel:=\\{n}$\3
\2\&{else} \0$\\{intmin}\mathrel:=\\{m}$
;
\2\&{end};


\secbegin \head{The string handler}
Most PASCAL compilers will not support a whole set of ascii characters
nor any but fixed length strings. That is troublesome because the
object of \TEX's manipulations are precisely characters and strings.
Keeping in mind that \TEX\ reads and writes characters
as 7-bit ascii codes, we approach the problem in two ways:
\dispar
\hide{-} Strings known at compile time are replaced by integers by the preprocessor,
which saves the strings in a file (\.{STRINI.TBL} at WAITS) so that
they can be preloaded by this module in the most convenient way.
 When needed, the main \TEX\ module will call \\{Print} if it wants
a string to be printed or \\{ProduceString} if it wants the string
itself for some other purpose. Presently, strings are kept in a
\\{strngpool} and an associated array of string pointers.\par
\dispar
\hide{-} Anything read from a file or the terminal is treated in a character
by character basis using the procedures in the following chapter.
For each system, there should be a file (which at WAITS is
called \.{ASCII.TBL}) that contains one string for each ascii character
indicating how the character should be printed.\par

\secbegin \6Globals in the outer block{ \:m15\7} \.{+=}\par
\pascal
\2$\\{strng}\mathrel:\mathop{\&{array }}[-1\mathrel{\!.\,.\!}999]\mathop{\&{\ of }\!}
\\{integer}$;\40\ $\{\;$indexes into the \\{strngpool}$\;\}$
\2$\\{strngpool}\mathrel:\mathop{\&{packed }\!}\mathop{\&{array }}[-1\mathrel{\!.\,.\!}6000]\mathop{\&{\ of }\!}
\\{asciiCode}
$;
\2$\\{strnginx}\mathrel:\\{integer}$;\40\ $\{\;$points into the \\{strng} array$\;\}$
\2$\\{poolinx}\mathrel:\\{integer}$;\40\ $\{\;$points into the \\{strngpool} array$\;\}$


\secbegin The procedure \\{InitStrings} reads the ascii-table and the printable strings
into \\{strngpool} and \\{strng}.  At WAITS, lines are terminated by <cr>.
\pascal
\1\3\2\1\1\&{procedure} $\\{InitStrings}$;
\3\2\1\&{label} \0\\{continue},\45\ \0\\{done};
\3\2\1\&{var} $\\{c}\mathrel:\\{asciiCode}$;
\2$\\{chartable}\mathrel:\\{boolean}$;
\3\2\&{begin} \0$\\{strng}[-1]\mathrel:=-1$;
\0$\\{strngpool}[-1]\mathrel:=\\{null}$;\40\
$\{\;$true null$\;\}$
\2$\\{strng}[0]\mathrel:=0$;
\0$\\{strnginx}\mathrel:=1$;
\0$\\{poolinx}\mathrel:=0$;
\0$\\{reset}(\\{ichan1},\45\\{ascfilnam},\450,\45\\{libraryarea}
)
$;
\0$\\{chartable}\mathrel:=\\{true}$;
\2\\{continue}: \0\1\&{while} $\mathop{\&{not }\!}\\{eof}(\\{ichan1})$ \&{do}
\2\&{begin} \0$\\{c}\mathrel:=\\{ord}(\\{ichan1}{\up})$;
\2\1\&{while} $\\{c}=\\{null}$ \&{do}
\2\&{begin} \0$\\{get}(\\{ichan1})$;
\0$\\{c}\mathrel:=\\{ord}(\\{ichan1}{\up})$
\2\&{end}\3
;
\2\1\&{while} $(\\{c}=\\{carriagereturn})\mathbin{\&{or}}(\\{c}=\\{formfeed})
$ \&{do}
\2\&{begin} \0$\\{strngpool}[\\{poolinx}]\mathrel:=\\{null}$;
\0$\\{Increment}(\\{poolinx})$;\40\
$\{\;$set delimiting \\{null}$\;\}$
\2$\\{strng}[\\{strnginx}]\mathrel:=\\{poolinx}$;
\0$\\{Increment}(\\{strnginx})$;\40\
$\{\;$pointer to first character of next string$\;\}$
\2\1\&{repeat} \0$\\{get}(\\{ichan1})$;
\2\1\&{if} $\\{eof}(\\{ichan1})$ \&{then}
\0$\mathop{\&{goto }\!}\\{done}$\3
;
\2$\\{c}\mathrel:=\\{ord}(\\{ichan1}{\up})$
\3\2\&{until} $(\\{c}<>\\{linefeed})\mathbin{\&{and}}(\\{c}<>\\{null})
$;\40\
$\{\;$skip \\{linefeed}s and \\{null}s$\;\}$
\2\&{end}\3
;
\2$\\{strngpool}[\\{poolinx}]\mathrel:=\\{c}$;
\0$\\{Increment}(\\{poolinx})$;
\0$\\{get}(\\{ichan1})$
\2\&{end}\3
;
\2\\{done}: \0\1\&{if} $\\{chartable}$ \&{then}
\2\&{begin} \0$\\{chartable}\mathrel:=\\{false}$;
\0$\\{reset}(\\{ichan1},\45\\{strfilnam},\450,\45\\{libraryarea}
)
$;
\0$\mathop{\&{goto }\!}\\{continue}$
\2\&{end}\3
;
\2$\\{reset}(\\{ichan1})$;
\2\&{end};


\secbegin The procedure \\{ProduceString} will return a string in \\{namestring}.
If $\\c≤\\{filnam}(0)$ then this string is obtained from the \\{strngpool} using \\c
as an index, otherwise it is the name of font number \\c.
\pascal
\1\3\2\1\1\&{procedure} $\\{ProduceString}(\\{c}\mathrel:\\{integer};\42\,\mathop{\&{var}}\\{namestring}
\mathrel:
\\{asciiString}
)
$;
\3\2\1\&{var} $\\{i},\45\\{j}\mathrel:\\{integer}$;
\3\2\&{begin} \0\1\&{if} $\\{c}<=\\{filnam}(0)$ \&{then}\40\
$\{\;$get the name of the file from \\{fileName}$\;\}$
\2$\\{Unpack}(\\{fileName}[\\{filnam}(\\{c})],\45\\{namestring},\45
0
)
$\3
\2\&{else} \1\&{begin} \0$\\{i}\mathrel:=-1$;
\0$\\{j}\mathrel:=\\{strng}[\\{c}]-1$;
\2\1\&{repeat} \0$\\{Increment}(\\{j})$;
\0$\\{Increment}(\\{i})$;
\0$\\{namestring}[\\{i}]\mathrel:=\\{strngpool}[\\{j}]
$
\3\2\&{until} $\\{strngpool}[\\{j}]=\\{null}$
\2\&{end}\3
\2\&{end};
\index
\\ASCII:12.
\\AppendToName:1, 54, 55, 56.
\\AppndReal:1, 22.
\\AppndString:1, 21.
\\B:12, 23, 37, 56, 61, 63.
\\ChanPtr:26, 39.
\\CloseOut:1, 69.
\\Close:1, 30, 55.
\\DSK:55.
\\DeclareOFil:1, 50.
\\Decrement:\&{11}, 37, 45, 56.
\\DvI:1, 67, 68, 69.
\\ERRORSTEM:12.
\\FOOBARTTY:12.
\\ForceBufferOut:1, 38.
\\GetChan:26, 39.
\\GetFirstLine:1, 40, 43.
\\GetTableSizes:1, 72.
\\InChTer:1, 32, 48.
\\InLnTer:1, 32, 48.
\\InLn:1, 39, 40, 42, 44.
\\Increment:\&{11}, 19, 20, 21, 22, 32, 36, 37, 38, 39, 44, 50, 55, 56, 67, 69.
\\InitDelimTb:1, 72.
\\InitEqTb:1, 72.
\\InitFMem:1, 72.
\\InitFileName:1, 53.
\\InitHyphenTb:1, 74.
\\InitPageTb:1, 72.
\\InitSecondMem:1, 72.
\\InitStrings:1, 19.
\\InitSysdep:1, 23.
\\IntOut:1, 68, 69.
\\LowerCase:\&{11}, 56.
\\OutChErr:1, 34, 49.
\\OutChTer:33, 47.
\\OutLnErr:1, 34.
\\PST:\&{66}, 69.
\\PTEXINTBL:12.
\\PrintFileName:1, 38.
\\PrintInt:1, 37, 44.
\\PrintLn:1, 36, 54.
\\PrintOctal:1, 37.
\\PrintReal:1, 37.
\\Print:1, 36, 37, 38, 40, 42, 44.
\\ProduceString:1, 20, 21.
\\ReadFontInfo:1, 59.
\\Release:1, 45.
\\RsetFile:26, 55.
\\RwriteFile:28, 55.
\\STRINITBL:12.
\\SendCh:1, 35.
\\SendLn:1, 35.
\\SendStarted:1, 29, 55.
\\SetTableSizes:1, 71.
\\TBL:12.
\\TEXOUTDVI:12.
\\TEX:53.
\\TFM:53.
\\TTY:13.
\\TraceLine:1, 46.
\\Unpack:20, 21, 22.
\\UpperCase:\&{11}, 50, 56.
\\WriteDelimTb:1, 71.
\\WriteEqTb:1, 71.
\\WriteFMem:1, 71.
\\WriteHyphenTb:1, 71.
\\WritePageTb:1, 71.
\\WriteSecondMem:1, 71.
\\alphaset:72, 73.
\\ascfilnam:\&{12}, 19.
\\asciiCode:11, 18, 19, 26, 31, 32, 33, 34, 35, 36, 37, 39, 40, 46, 50, 69.
\\asciiString:11, 20, 21, 22, 38, 50, 52.
\\ascii:15, 25, 27.
\\atclause:59, 61.
\\barray:71, 74.
\\bc:59, 60, 62.
\\boolean:19, 26, 29, 37, 39, 40, 50, 54, 59, 72.
\\brchar:32, 39, 40, 42, 44, 46, 48.
\\break:32, 38.
\\btableEntryLength:\&{4}, 71, 74.
\\btableVariant:71, 73, 74.
\\btable:71, 74.
\\btabsize:\&{4}, 71, 74.
\\bufPtr:32, 39, 40, 42, 44, 46, 47, 48.
\\buffer:32, 39, 40, 41, 42, 44, 46, 47, 48, 49.
\\buffir:31, 32, 39, 40, 46.
\\bufsize:\&{4}, 31, 32.
\\byte0:8, 67.
\\byte1:8, 67.
\\byte2:8, 67.
\\byte3:8, 61, 67.
\\bytenum:23, 66, 67.
\\bytes4:8, 58, 71.
\\bytesPerWord:\&{4}, 67.
\\byte:67.
\\carriagereturn:\&{6}, 19, 32, 34, 35, 36, 39, 47, 48.
\\char6:24, 26, 28, 50.
\\char9:24, 26, 28, 50, 52.
\\charcodes:\&{11}, 54.
\\charsperfont:\&{4}, 58, 59, 71, 72.
\\chartable:19.
\\char:24.
\\chr:32, 33, 34, 35, 36, 47, 50, 56.
\\ch:54, 56.
\\cmmd:54.
\\code:73.
\\consonantPairEntry:\&{72}, 73.
\\continue:\&{9}, 19, 69.
\\convert:\&{65}, 69.
\\c:19, 20, 32, 33, 34, 35, 36, 39, 50.
\\dangerousfont:\&{58}, 59.
\\delimarray:71, 72.
\\delimtable:71, 72.
\\delim:71, 72.
\\done:\&{9}, 10, 19, 40, 43, 50, 55, 59.
\\dpbase:59, 64, 71, 72.
\\dsize:59, 61.
\\dstring:21, 22.
\\dummyFont:\&{10}, 55.
\\dvibytecnt:69.
\\dviword:23, 66, 67.
\\d:21, 22.
\\ec:59, 60, 62.
\\eightbits:\&{7}, 8, 73.
\\eight:\&{6}, 37.
\\eofChan:26, 39, 55.
\\eoff:39, 40, 42, 43, 44.
\\eof:19, 26, 29, 55, 72.
\\eqtbarray:71, 72.
\\eqtbsize:\&{3}, 71, 72.
\\eqtb:71, 72.
\\errfilnam:\&{12}, 23.
\\errfil:15, 23, 34, 36, 47, 69.
\\excephyphEntryLength:\&{4}, 71, 74.
\\excephyphVariant:71, 73, 74.
\\excephyph:71, 74.
\\excepsize:\&{4}, 71, 74.
\\exceptableEntryLength:\&{4}, 71, 74.
\\exceptable:71, 74.
\\exception:73, 74.
\\excepword:\&{72}, 73.
\\excparray:71, 74.
\\excphyarray:71, 74.
\\excptableVariant:71, 73, 74.
\\extbase:59, 64, 71, 72.
\\extension:52, 56.
\\failure:\&{9}, 53, 55.
\\falsex:73.
\\false:19, 37, 39, 43, 50.
\\fbasearray:58, 59, 69, 71, 72.
\\fbc:59, 62.
\\fbt:59, 61, 62.
\\fcksum:59, 61, 69, 71, 72.
\\fc:59, 62.
\\fdevice:26, 28.
\\fdirectory:26, 28.
\\fdir:52, 53, 55, 56.
\\filPtr:15, 23, 45, 53, 55.
\\fileName:15, 20, 21, 22, 23, 38, 50, 55, 69.
\\filetype:52, 53, 55, 56.
\\filnam:\&{10}, 20, 21, 22.
\\fil:52, 53, 55.
\\first:46, 47, 48, 49.
\\five:\&{6}, 37.
\\fj:52, 53, 55, 56.
\\fl:59, 60.
\\fmag:59, 61, 69, 71, 72.
\\fmemarray:58, 59, 71, 72.
\\fmemoverflow:\&{58}, 59.
\\fmemptr:59, 71, 72.
\\fmemsize:\&{4}, 58, 59, 71, 72.
\\fmem:59, 63, 71, 72.
\\fname:26, 28, 52, 53, 55, 56.
\\fnl:52, 53, 55, 56.
\\fnstate:52, 53, 55, 56.
\\fnstring:52, 53, 55, 56.
\\fntinfoarray:58, 59, 71, 72.
\\fnum:53.
\\fontfile:52, 53, 55, 56.
\\fontfil:15, 55, 60, 61, 62, 63.
\\fontinfo:59, 62, 71, 72.
\\fontused:69.
\\formfeed:\&{6}, 19, 39, 42, 44.
\\fourbyteSize:23.
\\fourbytemask:15, 23, 68.
\\fourbytes:8, 61, 62, 67, 71, 72.
\\four:\&{6}, 37.
\\fpfb:59, 61, 71, 72.
\\fpfiarray:58, 59, 71, 72.
\\fpfi:59, 61, 71, 72.
\\fprgmr:52, 53, 55, 56.
\\funnyscale:\&{63}, 64.
\\fyl:38, 39, 40, 42, 44, 45, 50, 59, 61, 62, 64.
\\f:69.
\\get:19, 26, 32, 48, 60, 61, 62, 63, 72, 74.
\\halves2:8, 71.
\\hasharray:71, 72.
\\hashpar:71, 72.
\\hashsend:71, 72.
\\hashsize:\&{3}, 3, 71, 72.
\\hash:71, 72.
\\hchar:72.
\\hheadarray:71, 72.
\\hhead:71, 72.
\\highbyte:68.
\\hoperand:73.
\\hprime:\&{3}, 71, 72.
\\htbase:59, 64, 71, 72.
\\hyphenbits:73.
\\icbase:59, 64, 71, 72.
\\ichan1:19, 25, 26, 45.
\\ichan2:25, 26, 45.
\\ichan3:25, 26, 45.
\\ichan4:25, 26, 45.
\\ichan5:25, 26, 45.
\\ichan6:25, 26, 45.
\\id:26, 28.
\\inputFile:\&{10}, 53.
\\inputfile:52, 53, 55.
\\integer:8, 15, 16, 18, 20, 21, 22, 23, 26, 28, 29, 30, 32, 35, 36, 37, 38, 39, 40, 45, 46, 50, 52, 53, 54, 58, 59, 66, 67, 68, 69, 71, 72, 73, 74.
\\intmax:16, 62.
\\intmin:16, 62.
\\int:8, 23, 59, 61, 62, 63, 67, 71, 72.
\\i:20, 21, 22, 23, 36, 37, 38, 50, 59, 61, 62, 63, 64, 68, 69.
\\jj:54.
\\j:20, 21, 22, 46, 47, 49, 50, 69, 71, 72, 74.
\\krbase:59, 64, 71, 72.
\\k:37, 71, 72, 74.
\\lastpageptr:69.
\\last:46, 47, 48, 49.
\\lc:59, 62.
\\lec:59, 62.
\\lgbase:59, 64, 71, 72.
\\lhword:8, 60.
\\lh:59, 60, 61.
\\libraryarea:\&{12}, 19, 55, 71, 72.
\\lineEnd:\&{32}, 32, 39.
\\linefeed:\&{6}, 19, 34, 35, 36, 39, 47, 48.
\\locs:\&{3}, 71, 72.
\\magnification:69.
\\malformedname:\&{9}, 54.
\\maxfil:\&{4}, 15.
\\maxfnt:\&{4}, 10, 58, 69, 71, 72.
\\maximumDistinctionLength:\&{72}, 72.
\\maximumExceptionLength:\&{72}, 73.
\\maxinfil:\&{4}, 4, 53.
\\maxint:23.
\\maxlinelength:\&{4}, 39.
\\maxpageheight:69.
\\maxpagewidth:69.
\\memarray:71, 72.
\\memoryword:8, 15, 58, 59, 66, 71, 72.
\\memsize:\&{2}, 71, 72.
\\mem:71, 72.
\\mes:36.
\\metricscale:59, 61, 63.
\\msb:37.
\\mword:71, 72.
\\m:16, 37, 59, 60, 63.
\\namepart:52, 53, 55, 56.
\\namestring:20.
\\nd:59, 60, 64.
\\needmore:\&{9}, 56.
\\ne:59, 60, 64.
\\nfonts:\&{4}, 4, 23, 53, 55.
\\nh:59, 60, 64.
\\nine:\&{6}, 37.
\\ni:59, 60, 64.
\\nk:59, 60, 64.
\\nl:59, 60, 64.
\\nodev:50.
\\np:59, 60, 64.
\\null:\&{6}, 19, 20, 21, 22, 23, 36, 38, 39, 50, 53, 55.
\\nw:59, 60, 64.
\\n:16, 37.
\\ochan0:27, 28, 29, 30, 35.
\\ochan1:27, 28, 29, 30, 35.
\\ochan2:27, 28, 29, 30, 35.
\\ochan3:27, 28, 29, 30, 35.
\\ochan4:27, 28, 29, 30, 35.
\\ochan5:27, 28, 29, 30, 35.
\\ochan6:27, 28, 29, 30, 35.
\\ochan7:27, 28, 29, 30, 35.
\\ochan8:27, 28, 29, 30, 35.
\\ochan9:27, 28, 29, 30, 35.
\\oldbrchar:46, 48.
\\oneOfFive:5.
\\oneOfFour:5, 8.
\\oneOfSix:5, 73.
\\oneOfTwo:5, 8, 73.
\\onebyteSize:\&{65}, 68.
\\one:\&{6}, 37, 40.
\\opcode:73.
\\oprand:73.
\\ord:19, 26, 32, 48.
\\otherchar:\&{11}, 11.
\\outdev:50.
\\outfilnam:\&{12}, 50.
\\outfil:15, 50, 67, 69.
\\outfylnam:50.
\\outputFile:\&{10}, 50.
\\packedAlphas:72, 73.
\\packedAsciiString:11, 15.
\\packedConsonantPairEntry:73, 74.
\\packedHyphenbits:73, 74.
\\pack:21, 22, 55.
\\pagememarray:71, 72.
\\pagememsize:\&{4}, 71, 72.
\\pagemem:71, 72.
\\page:40, 42, 44.
\\parbase:59, 64, 69, 71, 72.
\\poolinx:18, 19, 21, 22.
\\postambleptr:69.
\\prefixEntryLength:\&{4}, 71, 74.
\\prefixVariant:71, 73, 74.
\\prefixarray:71, 74.
\\prefixtp:73, 74.
\\prefix:71, 74.
\\prefsize:\&{4}, 71, 74.
\\problems:54.
\\programmer:52, 55, 56.
\\project:52, 56.
\\psize:59, 61.
\\pts:8, 63, 71, 72.
\\put:33, 34, 35, 36, 47, 67, 71.
\\p:59, 63, 64.
\\readoutVariable:71, 74.
\\readoutVariant:71, 73, 74.
\\readoutsize:\&{4}, 73.
\\real:8, 22, 37, 59, 69, 71.
\\reset:19, 26, 30, 32, 45, 55, 69, 72.
\\return:\&{9}, 53, 54, 56.
\\rewrite:23, 28, 50, 71.
\\rhword:8, 60.
\\round:37.
\\rsusperpt:\&{65}, 65.
\\scale:\&{63}, 64.
\\secondmem:\&{2}, 71, 72.
\\sendfile:52, 53, 55.
\\seven:\&{6}, 37.
\\shortAsciiAlphas:\&{72}, 73.
\\shortAsciiType:\&{72}, 72.
\\sixteenbits:\&{7}, 8.
\\six:\&{6}, 37.
\\sizesarray:71, 72.
\\sizestable:72.
\\skip:52, 56.
\\spacer:\&{11}, 54.
\\sstring:21, 22.
\\stream:29, 30, 35.
\\strfilnam:\&{12}, 19.
\\stringsize:\&{10}, 11, 50, 53, 56.
\\strnginx:18, 19, 21, 22.
\\strngpool:18, 19, 20, 21, 22, 36.
\\strng:18, 19, 20, 21, 22, 36.
\\suffixEntryLength:\&{4}, 71, 74.
\\suffixVariant:71, 73, 74.
\\suffixarray:71, 74.
\\suffixtp:73, 74.
\\suffix:71, 74.
\\sufsize:\&{4}, 71, 74.
\\sysdep:1.
\\s:21, 22, 37, 38, 50.
\\tableReadoutType:71, 73, 74.
\\tblfilnam:\&{12}, 71, 72.
\\tblfil:15, 71, 72, 74.
\\terDevice:13, 23, 32.
\\terIn:15, 32, 48.
\\terOut:15, 23, 32, 33, 36, 38, 47.
\\terfilnam:\&{12}, 23, 32.
\\texpars:\&{3}, 3.
\\threebyteSize:\&{65}, 68.
\\three:\&{6}, 37.
\\truex:73.
\\true:19, 37, 39, 40, 50.
\\trunc:22, 37, 61, 65.
\\truthx:73.
\\twobyteSize:\&{65}, 68.
\\twohalves:8, 60, 71, 72.
\\two:\&{6}, 37, 42.
\\unpack:38, 50.
\\wdbase:59, 64, 71, 72.
\\weak:72.
\\x:16, 37.
\\y:16.
\\zero:\&{6}, 37.
\endindex